import { http } from '@/utils/http'
import type { ILoginData, ILoginRes } from './common.model'

enum Api {
  Upload = '/admin/common/upload.do',
  Login = '/admin/user/loginIn.do',
  // GetVeriCodeImg = '/api/admin/user/getVeriCodeImg.do',
  GetVeriCodeImg = '/api/test',
}

/**
 * 上传
 * @param data 
 * @returns 
 */
export const Upload = (data: ILoginData) => {
  return http.post(Api.Upload, data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 登录
 * @param data 
 * @returns 
 */
export const Login = (data: ILoginData): Promise<ILoginRes> => {
  return http.post(Api.Login, data, {})
}

/**
 * 获得验证码
 * @returns 
 */
export const GetVeriCodeImg = () => {
  return http.get(Api.GetVeriCodeImg, {})
}
